Last Update: 2025/3/26
LLMVision Image Generation API
The LLMVision Image Generation API allows you to create images from textual descriptions using LLMVersion's DALL-E model. This document provides an overview of the API endpoints, request parameters, and response structure.
Endpoint
POST https://platform.llmprovider.ai/v1/images/generations
Request Headers
Header | Value |
---|---|
Authorization | Bearer YOUR_API_KEY |
Content-Type | application/json |
Request Body
The request body should be a JSON object with the following parameters:
Parameter | Type | Description |
---|---|---|
model | string | The model to use for image generation. |
prompt | string | A text description of the desired image(s). |
n | integer | (Optional) The number of images to generate. Defaults to 1. |
size | string | (Optional) The size of the generated images. Options: "256x256", "512x512", "1024x1024". |
response_format | string | (Optional) The format of the generated images. Options: "url" or "b64_json". |
user | string | (Optional) A unique identifier for tracking your requests. |
Example Request
{
"model": "ALLTools-dalle",
"prompt": "A cute baby sea otter",
"n": 1,
"size": "1024x1024",
"response_format": "url"
}
Response Body
The response body will be a JSON object containing the generated images and related metadata.
Field | Type | Description |
---|---|---|
created | integer | The timestamp for when the image was created. |
data | array | An array of generated image objects. |
Example Response
{
"created": 1678891234,
"data": [
{
"url": "https://..."
},
{
"url": "https://..."
}
]
}
Example Request
- Shell
- nodejs
- python
curl -X POST https://platform.llmprovider.ai/v1/images/generations \
-H "Authorization: Bearer $YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "ALLTools-dalle",
"prompt": "A cute baby sea otter",
"n": 1,
"size": "1024x1024"
}'
const axios = require('axios');
const apiKey = 'YOUR_API_KEY';
const url = 'https://platform.llmprovider.ai/v1/images/generations';
const data = {
model: 'ALLTools-dalle',
prompt: 'A cute baby sea otter',
n: 1,
size: '1024x1024'
};
const headers = {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json'
};
axios.post(url, data, { headers })
.then(response => {
console.log('Response:', response.data);
})
.catch(error => {
console.error('Error:', error);
});
import requests
import json
api_key = 'YOUR_API_KEY'
url = 'https://platform.llmprovider.ai/v1/images/generations'
headers = {
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json'
}
data = {
model: 'ALLTools-dalle',
'prompt': 'A cute baby sea otter',
'n': 1,
'size': '1024x1024'
}
response = requests.post(url, headers=headers, data=json.dumps(data))
if response.status_code == 200:
print('Response:', response.json())
else:
print('Error:', response.status_code, response.text)
For any questions or further assistance, please contact us at [email protected].